<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="/Public/Admin/css/base.css"/>
    <link rel="stylesheet" href="/Public/Admin/css/info-mgt.css"/>
    <link rel="stylesheet" href="/Public/Admin/css/WdatePicker.css"/>
    <title>移动办公自动化系统</title>
    <style type='text/css'>

        table tr .cb {
            width: 63px;
            text-align: center;
        }

        table tr .id {
            width: 63px;
            text-align: center;
        }

        table tr .name {
            width: 118px;
            padding-left: 17px;
        }

        table tr .nickname {
            width: 63px;
            padding-left: 17px;
        }

        table tr .dept_id {
            width: 63px;
            padding-left: 13px;
        }

        table tr .sex {
            width: 63px;
            padding-left: 13px;
        }

        table tr .birthday {
            width: 80px;
            padding-left: 13px;
        }

        table tr .tel {
            width: 113px;
            padding-left: 13px;
        }

        table tr .email {
            width: 160px;
            padding-left: 13px;
        }

        table tr .addtime {
            width: 160px;
            padding-left: 13px;
        }

        table tr .operate {
            padding-left: 13px;
        }
    </style>
</head>

<body>
<div class="title"><h2>公文管理</h2></div>
<div class="table-operate ue-clear">
    <a href="/index.php/Admin/Doc/add" class="add">添加</a>
    <a href="javascript:;" class="del">删除</a>
    <a href="javascript:;" class="edit">编辑</a>
    <a href="javascript:;" class="count">统计</a>
    <a href="javascript:;" class="check">审核</a>
</div>
<div class="table-box">
    <table>
        <thead>
        <tr>
            <th class="cb"></th>
            <th class="id">序号</th>
            <th class="name">标题</th>
            <th class="file">附件</th>
            <th class="content">内容</th>
            <th class="author">作者</th>
            <th class="addtime">添加时间</th>
            <th class="operate">操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($result)): $i = 0; $__LIST__ = $result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i;?><tr>
                <td class="cb" align="center">
                    <input type="checkbox" class="checkbox" align="center" value="<?php echo ($vol["id"]); ?>"/>
                </td>
                <td class="id"><?php echo ($vol["id"]); ?></td>
                <td class="name"><?php echo (msubstr($vol["title"],0,8)); ?></td>

                <td class="file"><?php echo ($vol["filename"]); ?>
                    <?php if(!empty($vol["filename"])): ?><a href="/index.php/Admin/Doc/download/id/<?php echo ($vol["id"]); ?>">下载</a><?php endif; ?>
                </td>
                <td class="content"><?php echo (htmlspecialchars_decode($vol["content"])); ?></td>
                <td class="author"><?php echo ($vol["author"]); ?></td>
                <td class="addtime"><?php echo (date('Y-m-d H:i:s',$vol["addtime"])); ?></td>
                <td class="operate"><a href="#" class="lay" data='<?php echo ($vol["id"]); ?>'
                                       data-title='<?php echo ($vol["title"]); ?>'>查看内容&nbsp|&nbsp</a>
                    <a href='/index.php/Admin/Doc/edit/id/<?php echo ($vol["id"]); ?>' >编辑&nbsp|&nbsp</a>
                    <a href="#" onClick="return disp_confirm('<?php echo ($vol["id"]); ?>')">删除</a>
                </td><!--removeFromCart('${item.product.pid}')-->

            </tr><?php endforeach; endif; else: echo "" ;endif; ?>

        </tbody>
    </table>
</div>
<div class="pagination ue-clear">
    <div class="pagin-list">
        <?php echo ($page); ?>
    </div>
    <div class="pxofy">共 <?php echo ($count); ?> 条记录</div>
</div>
</body>
<script type="text/javascript" src="/Public/Admin/js/jquery.js"></script>
<script type="text/javascript" src="/Public/Admin/js/common.js"></script>
<script type="text/javascript" src="/Public/Admin/js/WdatePicker.js"></script>
<script type="text/javascript" src="/Public/Admin/plugin/layer/layer.js"></script>
<script type="text/javascript">


    function disp_confirm(id) {
        if (confirm("你确定要删除?")) {
            // alert('/index.php/Admin/Doc/delete/id/' + id);
            location.href = '/index.php/Admin/Doc/delete/id/' + id;
        }
    }

    $(function () {
        $(".del").on("click", function () {

            var number = '';
            if ($("input[type='checkbox']:checked").length == 0) {
                alert('请选中要删除的用户');
                return;
            }
            $('input:checkbox:checked').each(function (k) {
                if (k == 0) {
                    number = $(this).val();
                } else {
                    number += ',' + $(this).val();
                }
            });
            location.href = "/index.php/Admin/Doc/delete/id/" + number;
        });
        $('.lay').on('click', function () {
            // alert('aaaaaaaaa');
            // layer.msg('hello');
            // layer.alert('aaaaaaa');
            //获取id
            var id = $(this).attr('data');
            //获取公文标题
            var title = $(this).attr('data-title');
            // layer.open({
            //     type: 2,
            //     title: title,
            //     area: ['600px', '360px'],
            //     shadeClose: true, //点击遮罩关闭
            //     content: '/index.php/Admin/Doc/showContent/id/' + id //iframe的url
            // });
            layer.open({
                type: 2,
                title: title,
                area: ['600px', '360px'],
                shadeClose: true, //点击遮罩关闭
                content: "/index.php/Admin/Doc/showContent/id/" + id //iframe的url
            });
        });
    });

    $(".select-title").on("click", function () {
        $(".select-list").hide();
        $(this).siblings($(".select-list")).show();
        return false;
    })
    $(".select-list").on("click", "li", function () {
        var txt = $(this).text();
        $(this).parent($(".select-list")).siblings($(".select-title")).find("span").text(txt);
    })

    $("tbody").find("tr:odd").css("backgroundColor", "#eff6fa");

    showRemind('input[type=text], textarea', 'placeholder');
</script>
</html>